#pragma once
#include <string>
#include <vector>
#include <functional>
#include <iostream>
#include <Event.h>
#include <GLFW/glfw3.h>

namespace test
{
    class Test
    {
    public:
        Test() {}
        virtual ~Test() {}

        virtual void OnUpdate(float deltaTime) {}
        virtual void OnRender() {}
        virtual void OnImGuiRender() {}
        virtual void OnEvent(Event& e){};

    };
    /**
     * @brief 警告，这是一个单例，但构造函数仍是public,因为我懒得改
     *
     */
    class TestMenu: public Test
    {
    private:
        Test*& m_CurrentTest;
        std::vector<std::pair<std::string, std::function<Test*()>>> m_Tests;
        GLFWwindow *m_window;
        static TestMenu*s_Instance;
    public:
        TestMenu(Test*& currentTestPtr,GLFWwindow *window);
        GLFWwindow * getNativeWindow(){return m_window;}
        inline static TestMenu& Get() { return *s_Instance; }
        virtual void OnEvent(Event& e)override;
        void OnImGuiRender() override;
        void show()
        {
            std::cout<<"888";
            int i=1;
        }
        template<typename T>
        void RegisterTest(const std::string& name)
        {
            std::cout << "Register test: " << name << std::endl;

            m_Tests.push_back(std::make_pair(name, []() { return new T(); }));
        }
    };

}
